//
// Created by zken on 2024/12/2.
//
#include <iostream>

using namespace std;

#include <vector>

#ifndef PROJECTLIZE_FOURTHTUPLE_H
#define PROJECTLIZE_FOURTHTUPLE_H


class FourthTuple {
private:
    /*
            Op：四元组的操作
            Arg1：四元组的参数1
            Arg2：四元组的参数2
            Tag：四元组的标记，可以是临时变量
     */

    string lineId;
    string op;
    string arg1;
public:
    void setLineId(const string &lineId);

private:
    string arg2;
    string tag; // 临时变量值
public:

    const string &getArg2() const;

    void setArg2(const string &arg2);

    const string &getOp() const;

    const string &getLineId() const;

    void setOp(const string &op);

    const string &getArg1() const;

    void setArg1(const string &arg1);

    const string &getTag() const;

    void setTag(const string &tag);

    // 初始化
    FourthTuple();

    FourthTuple(const string &op, const string &arg1, const string &arg2, const string &tag);

    string getToString() {
        string ret;
        ret = "(" + ret + lineId + ") ";
        ret = ret + op + " ";
        ret = ret + arg1 + " ";
        ret = ret + arg2 + " ";
        ret = ret + tag + " ";
        return ret;
    };
};

class FourthTupleList {
private:
    vector<FourthTuple> list;
    vector<string> colTags = vector<string>({"OP", "arg1", "arg2", "TAG"});
public:
    vector<string> getColTags()
    {
        return colTags;
    }
public:

    int tempCnt = 0;

    void setList(const vector<FourthTuple> &list);

    string newTemp = "new_temp";

    const vector<FourthTuple> &getList() const;

    void gen(const FourthTuple &t); // 弃用掉
    FourthTuple gen(const string &op, const string &arg1, const string &arg2, const string &tag);

    string getNextLineId();
};


#endif //PROJECTLIZE_FOURTHTUPLE_H
